home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / program / slix0987.zip / GMUTILS.ZIP / BINTOC.DOC < prev    next >
Text File  |  1995-06-22  |  3KB  |  73 lines

  1.                        BINTOC - Binary To C -converter
  2.  
  3.                                 Documentation
  4.                               by Petri Hassinen
  5.  
  6.                             Contact via Internet:
  7.                             phassine@alpha.hut.fi
  8.  
  9.  
  10. PURPOSE
  11.          BINTOC is a utility for converting binary files into an ASCII form
  12.          that can be directly linked into your executables with the help of a
  13.          C compiler. BINTOC also supports the inclusion of multiple source
  14.          files into the same target file.
  15.  
  16.  
  17. OPERATION
  18.          BINTOC reads a portion of a binary file into one of its memory
  19.          buffers. Then the data is formulated into C and written to a target
  20.          file. In this way, BINTOC can deal with files of any sizes. 
  21.  
  22.          Care must be taken when a variable name is specified for your data
  23.          since no syntactic checking takes place. You can easily specify
  24.          names that are not recognized by C compilers. However, should you
  25.          specify an incorrect name inadvertently you can always regenerate
  26.          the file or edit it with a text editor to fix your mistake.
  27.  
  28.          BINTOC recognizes only two separate switches. One tells the program
  29.          to overwrite the previously existing file without warning and the
  30.          other is used to append the files into the same target file.
  31.  
  32.          The target file that BINTOC creates is 5 times the size of the
  33.          original size.
  34.  
  35.          For more information, type "BINTOC /?" at the DOS prompt.
  36.  
  37.  
  38. EXAMPLES
  39.          Suppose that you have a picture that you want to link into your
  40.          program. By doing so you increase the size of your program but also
  41.          effectively hide the actual data from curious rippers. In addition,
  42.          you do not have to load the picture file explicitly from a disk. So,
  43.          this is what you do:
  44.  
  45.          Picture file: MYPIC.RAW
  46.          Program file: MYPROG.C
  47.  
  48.          1. Convert your picture into C by writing:
  49.          BINTOC mypic.raw mypic.c mypic[]
  50.          If you want to add e.g. another picture into the same file (mypic.c)
  51.          you can write: 
  52.          BINTOC mypic2.raw mypic.c mypic2[] /A
  53.          The data is thus appended to the previously existing file. If you
  54.          use this switch and the previous file does not exist, it is created.
  55.  
  56.          2. After the conversion, add the following line to the beginning of
  57.          your program file:
  58.          extern unsigned char mypic[];
  59.  
  60.          3. Add the file mypic.c to your project or makefile.
  61.  
  62.          4. Write the code to process the picture by reading it from the
  63.          array mypic[].
  64.  
  65.          5. Compile and link your program and voilá, you have done it!
  66.  
  67.  
  68. IN CONCLUSION                                              
  69.          The source code for BINTOC (both DOS and UNIX versions) is available
  70.          to all interested parties. Just contact me and I'll send it to you
  71.          via email.
  72.  
  73. EOF